<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsp/include/taglib.jsp"%>
<%@ include file="/jsp/include/headform.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<html>
<head>
    <base href="<%=basePath%>">

    <title>修改版本</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
	<script src="${ctxStatic}/ckeditor/ckeditor.js"></script>
    <script type="text/javascript">
    	 		$(function(){
			
			$('#saveBtn').click(save);
			
			$("#form").validate();
			
			$("#resetBut").click(function(){
				$("#form input:text").not('.readonly').val("");
				$("#form select").val("");
			});				
		})
		
		function save(){
			if(!$("#form").valid()){
				return false;
			}
			
			$('#handle_zone_loading').show();
			$(".btnSubmit").attr("disabled","disabled");
			
			
			$('#form').ajaxSubmit({
				type: 'post',
				url: '${ctx}/version',
				success: function(result) { // data 保存提交后返回的数据，一般为 json 数据
	                alert('提交成功！');
	                window.close();
	            },
	            error: function(){
		           	alert("对不起！你的请求出现异常，请联系服务人员！");
	                $('#handle_zone_loading').hide();
	                $(".btnSubmit").removeAttr("disabled");	            	
	            }
			});
		}
    </script>
</head>

<body class="Flow">

    <div class="f_bg">

        <div class="logo_1"></div>

        <div class="gray_bg">

            <div class="gray_bg2">

                <div class="w_bg">

                    <div class="Bottom">

                        <div class="Top">

                            <h1 class="t_c">上海申通地铁集团有限公司<br>
                              	版本管理</h1>

                            <div class="mb10">
                                <form id="form" method="post">
                                	<input type="hidden" name="id" value="${version.id}"/>
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_2">
                                        <thead>
                                            <th colspan="4" class="f1">
                                                <h5 class="fl">基本信息</h5>
                                            </th>
                                        </thead>
                                        <tbody>
                                            <tr>
                                            	<td class="lableTd t_r"><div class="red">*</div>修志类别</td>
                                                <td width="35%">
                                                     <select id="u1_input" type="text" class="input_large required" name="chronType">
                                                        <c:forEach items="${fields.chronType.option}" var="op">
												          <option value="${op.key}" ${op.key==version.chronType ? 'selected':''}>${op.value}</option>
												        </c:forEach>
                                                    </select>
                                                </td>
                                                <td class="lableTd t_r"><div class="red">*</div>标题</td>
                                                <td width="35%">
                                                    <input type="text" class="input_large required" name="title" maxlength="20" value="${version.title}"/>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="lableTd t_r"><div class="red">*</div>稿件版本</td>
                                                <td>
                                                    <input type="text" class="input_large required" name="version" maxlength="20" value="${version.version}"/>
                                                </td>
                                                <td class="lableTd t_r"><div class="red">*</div>稿件类型</td>
                                                <td>
                                                      <select id="u1_input" type="text" class="input_large" name="type">
                                                        <c:forEach items="${fields.type.option}" var="op">
												          <option value="${op.key}" ${op.key==version.type ? 'selected':''}>${op.value}</option>
												        </c:forEach>
                                                      </select>
                                                </td>                                                
                                            </tr>
		                                  	<tr class="content7">
			                          	     	<td class="lableTd t_r">相关附件</td>
			                                    <td colspan="3">
												  	<iframe style="display:inline;" scrolling="auto" height="150" frameborder="0" marginheight="0" marginwidth="0" width="100%" id="attachFrame" name="attachFrame" 
												  	src="${ctx}/jsp/attach/fileUpload.jsp?modelName=version&modelId=${version.id}&procType=edit"></iframe>
												</td>
			                          	    </tr>    
		                                  		                          	                                                 
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                            <div class="mb10 t_c">
                                 <input type="button" class="btnSubmit" id="saveBtn" value="提 交" />
                                &nbsp;
              					<input type="button" id="btndel" value="关 闭" onclick="window.close()"/>
                                <!-- &nbsp;
              					<input type="button" class="btnSubmit" value="保存草稿" /> -->
                                &nbsp;
                                <input type="button" id="resetBut" value="重置" />
                                
								<div id="handle_zone_loading" style="width:100%;align:center;line-height:20px;display:none" class="">
							      <p style="width:auto;display:inline;"><img src="${ctxStatic}/images/loading2.gif" style="display:inline;"/>
							      <b style="color:green;display:inline;">&nbsp;正在提交</b></p>
							    </div>                                 
                            </div>
                            <div class="footer"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
